package _2_两数相加;

public class ListNode {
    int val;
    ListNode next;

    ListNode(int x) {
        val = x;
    }

    @Override
    public String toString() {
        StringBuilder outStr = new StringBuilder(String.valueOf(val));
        ListNode tmp = this;
        while (tmp.next != null) {
            outStr.append("->").append(tmp.next.val);
            tmp = tmp.next;
        }
        return outStr.toString();
    }
}
